Crate serde_indexed[−][src]
Derivation of Serialize
and Deserialize
that replaces struct keys with numerical indices.
Usage example
The macros currently understand serde
's skip_serializing_if
field attribute
and a custom offset
container attribute.
use serde_indexed::{DeserializeIndexed, SerializeIndexed}; #[derive(Clone, Debug, PartialEq, SerializeIndexed, DeserializeIndexed)] #[serde_indexed(offset = 1)] pub struct SomeKeys { pub number: i32, #[serde(skip_serializing_if = "Option::is_none")] pub option: Option<u8>, pub bytes: [u8; 7], }
Generated code example
cargo expand --test basics
exercises the macros using serde_cbor
.
Derive Macros
DeserializeIndexed | |
SerializeIndexed |